<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>PyTv! - Admin</title>
		<link type="text/css" href="../static/css/dark-hive/jquery-ui-1.8.1.custom.css" rel="stylesheet" />	
		<link type="text/css" href="../static/css/layout.css" rel="stylesheet" />	
		<link rel="stylesheet" type="text/css" href="../static/css/jquery.jgrowl.css"/>
		<script type="text/javascript" src="../static/js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="../static/js/jquery-ui-1.8.1.custom.min.js"></script>
		<script type="text/javascript" src="../static/js/jquery.jgrowl.js"></script>
        <script type="text/javascript" src="../static/js/admin.js"></script>
        
        <script type="text/javascript">
            if( !window.XMLHttpRequest ) XMLHttpRequest = function()
            {
              try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0") }catch(e){}
              try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0") }catch(e){}
              try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){}
              try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){}
              throw new Error("Could not find an XMLHttpRequest alternative.")
            };
            
            InstallFunction(server, 'ResetSerie');
            InstallFunction(server, 'SendMessage');
        </script>
        
		<script type="text/javascript">
			$(function(){

				// Accordion
				$("#accordion").accordion({ header: "h3" });
	
				// Tabs
				$('#tabs').tabs();
			
				//hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
				
			});
            
            $("#addText").live("keyup", function(event){
                if(event.keyCode == 13){
                    addSerie();
                }
            });
		</script>
        
	    <script type="text/javascript">
	        $(function() {
		        $("#selectable").selectable({
                    stop: function(){
                        val = $(".ui-selected").text();
                    }
                });
	        });
	    </script>
	</head>
	<body>
	    <p id="user"><a id="dialog_link" class="ui-state-default ui-corner-all" href="{{ logout_url }}"><span class="ui-icon ui-icon-power"></span>
            <b>{{ current_user }} - Logout</b>
        </a></p>
	
	    <div id="title">
            <div id="tagline">PyTv! - Admin</div>
	    </div>
        
        <div id="panelAdmin">
            <!-- Tabs -->
            <h2 class="demoHeaders">Admin Operations:</h2>
            <div id="tabs">
                <ul>
                    <li><a href="#tabs-1">Users</a></li>
                    <li><a href="#tabs-2">Series</a></li>
                    <li><a href="#tabs-3">Without Episodes</a></li>
                    <li><a href="#tabs-4">Notify</a></li>
                </ul>
                <div id="tabs-1">
                    {% if users %}
                        <p id="tabFollow">Users: {{cant}}</p>
                    {% else %}
                        <p id="tabFollow">No Users currently.</p>
                    {% endif %}
                    <div>
                        <ol id="selectable">
                            {% for user in users %}
                                <li class='ui-widget-content'><a href="#">{{ user }}</a></li>
                            {% endfor %}
                        </ol>
                    </div>
                </div>
                <div id="tabs-2">
                    Select the Name of a Tv Serie to Reset:
                    <p></p>
                    <div class="rowElem"><label>Serie: </label>
                        <select id="comboReset"/>
                            {% for serie in series %}
                                <option value="{{ serie }}">{{ serie }}</option>
                            {% endfor %}
                        </select>
                        <p>Actual Series: {{cantSeries}}</p>
                    </div>
                    <p>
                    <a href="javascript:resetSerie()" id="dialog_link" class="ui-state-default ui-corner-all">
                    <span class="ui-icon ui-icon-refresh"></span>Reset Calendar</a>
                    </p>
                </div>
                <div id="tabs-3">
                    <p>Series without Episodes: {{withcount}}</p>
                    <div>
                        <select id="comboWithout"/>
                            {% for with in without %}
                                <option value="{{ with }}">{{ with }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div id="tabs-4">
                    <p>Send a Message to all the Users:</p>
                    <textarea id="textMessage" class="text ui-widget-content ui-corner-all" rows="8" cols="70"></textarea>
                    <p>
                    <a href="javascript:sendMessage()" id="dialog_link" class="ui-state-default ui-corner-all">
                    <span class="ui-icon ui-icon-mail-closed"></span>Send</a>
                    </p>
                </div>
            </div>
        </div>
        
        <div id="notification" class="jGrowl bottom-right"></div>
        
	</body>
</html>


